import {
  SPACEID
} from "/constData/requestFun/_globalData";
import {
  GetFileConsumableManagement,
  PostFileConsumableManagement,
  PostUploadFile
} from "/constData/requestFun/_teseRequest";

Page({
  data: {
    utl: '',
    CorpId: '',
  },
  onLoad() {
    my.getStorage({
      key: 'userInfo',
      success: (storage) => {
        this.setData({
          CorpId: storage.data.result.userid
        })
      }
    })
  },
  InportData() {
    dd.uploadAttachmentToDingTalk({
      types: ['file'],
      file: {
        spaceId: SPACEID,
        max: 9,
        folderId: ''
      },
      success: (res) => {
        res.data.map((it) => {
          PostFileConsumableManagement(this.data.CorpId, it.spaceId, it.fileId, it.fileName, (res) => {
              console.log('res', res);
            },
            (fail) => {
              console.log('fail', fail);
            })
        })
        // PostFileConsumableManagement()
      },
      fail: () => {},
      complete: () => {},
    });
  },
  ExportData() {
    GetFileConsumableManagement();
  },
});